package deltax.common.resource
{

    public class Version extends Object
    {
        public var major:uint;
        public var middle:uint;
        public var minor:uint;
        public var revision:uint;
        public var reserve:uint;

        public function Version(param1:String = "255.255.255")
        {
            this.fromString(param1);
            return;
        }// end function

        public function fromString(param1:String) : void
        {
            var _loc_2:uint = 0;
            while (param1.charCodeAt(_loc_2) < 48 || param1.charCodeAt(_loc_2) > 57)
            {
                
                _loc_2 = _loc_2 + 1;
            }
            if (_loc_2 > 0)
            {
                param1 = param1.substr(_loc_2);
            }
            var _loc_3:* = param1.split(".");
            this.major = parseInt(_loc_3[0]);
            this.middle = parseInt(_loc_3[1]);
            this.minor = parseInt(_loc_3[2]);
            this.revision = _loc_3[3] ? (parseInt(_loc_3[3])) : (0);
            this.reserve = _loc_3[4] ? (parseInt(_loc_3[4])) : (0);
            return;
        }// end function

        public function toString() : String
        {
            var _loc_1:* = this.major + "." + this.middle + "." + this.minor;
            if (this.revision)
            {
                _loc_1 = _loc_1 + ("." + this.revision);
            }
            if (this.reserve)
            {
                _loc_1 = _loc_1 + ("." + this.reserve);
            }
            return _loc_1;
        }// end function

        public function get lowPart() : uint
        {
            return (this.revision << 16) + this.reserve;
        }// end function

        public function get heightPart() : uint
        {
            return (this.major << 24) + (this.middle << 16) + this.minor;
        }// end function

    }
}
